package logic

import (
	"context"
	"furniture/furniturerpc/furniturerpc"

	"furniture/api/internal/svc"
	"furniture/api/internal/types"

	"github.com/zeromicro/go-zero/core/logx"
)

type FurnitureShowLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewFurnitureShowLogic(ctx context.Context, svcCtx *svc.ServiceContext) *FurnitureShowLogic {
	return &FurnitureShowLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *FurnitureShowLogic) FurnitureShow(req *types.FurnitureShowRequest) (resp *types.Response, err error) {
	// todo: add your logic here and delete this line
	show, err := l.svcCtx.FurnitureRpc.FurnitureShow(l.ctx, &furniturerpc.FurnitureShowRequest{
		FurnitureId: req.Id,
	})
	if err != nil {
		return &types.Response{
			Code:    500,
			Message: "详情展示失败",
			Data:    nil,
		}, nil
	} else {
		return &types.Response{
			Code:    200,
			Message: "详情展示成功",
			Data:    show,
		}, nil
	}

}
